package com.css.dzj.zfjg.modules.detail.mapper;

import com.css.dzj.zfjg.modules.detail.entity.CreditPushInfo;
import com.css.dzj.zfjg.modules.detail.entity.Detail;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 反馈记录信息Mapper
 */
@Repository
public interface CreditPushInfoMapper extends JpaRepository<CreditPushInfo, String>, JpaSpecificationExecutor<CreditPushInfo>,
        QuerydslPredicateExecutor<CreditPushInfo> {

    @Query(value = "select Feedback_Org, count(Feedback_Org) as total from jg_xyjg_pushinfo mx  group by Feedback_Org",
            nativeQuery = true)
    List<Object[]> list(Pageable pageable);

    @Query(value = "select count(*) as month from jg_xyjg_pushinfo where Feedback_Time like CONCAT(:time,'%') and Feedback_Org = :provice",
            nativeQuery = true)
    String getMonthNumber(@Param("time") String time, @Param("provice") String provice);
}
